package com.qing.utils.lottery.ssq.analyse;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

@Data
public class AnalyserResult {

    private List<ResultSection> redSectionList;

    private List<ResultSection>blueSectionList;

    private String redTypeKey;

    public String getRedTypeKey() {
        String key = redTypeKey;
        if (key == null) {
            List<AnalyserResult.ResultSection> redSectionList = this.getRedSectionList();
            key = redSectionList.stream().map(sec -> sec.getCount() + sec.getSectionType().name()).collect(Collectors.joining("_"));
        }
        return key;
    }

    private String blueTypeKey;

    public String getBlueTypeKey() {
        String key = blueTypeKey;
        if (key == null) {
            List<AnalyserResult.ResultSection> redSectionList = this.getBlueSectionList();
            key = redSectionList.stream().map(sec -> sec.getCount() + sec.getSectionType().name()).collect(Collectors.joining("_"));
        }
        return key;
    }




    @Data
    @AllArgsConstructor
    public static class ResultSection{
        private int[] section;

        private int count;

        private SectionType sectionType;


    }

    public static enum SectionType {
        HIGH,

        MIDDLE_HIGH,

        MIDDLE,

        MIDDLE_LOW,

        LOW
    }
}
